<?php
/**
* basmallah.org
* 
*/
class dir extends DR_Controller
{
	function __Construct()
	{
		parent::__Construct();
		$this->load->model("yayasan");
	}
	
	function index()
	{
	}
	
	/**
	* ajax function untuk meload data yayasan
	*/
	function get_more($offset=null,$perpage=null)
	{
		$config['per_page'] = $perpage!=null?$perpage:9;	
		$offset = $offset!=null?$offset:$this->uri->segment(4);
		
		$filter = array();
		$this->yayasan->set_default_order(array("tgl_input"=>"desc"));
		$config['total_rows'] = $this->yayasan->get_count();		
		
		$data["max_offset"] = $config['total_rows'];
		$data["current_offset"] = $offset;
		$data["next_offset"] = (($offset + $config["per_page"])<$config['total_rows']?
								($offset + $config["per_page"]):
								($config['total_rows']-$config['per_page']));
								
		$data["prev_offset"] = ($offset - $config["per_page"])>0?($offset - $config["per_page"]):0;
		$data["has_more"] = ($offset + $config["per_page"])<$config['total_rows']?true:false;
		$data['result'] = $this->yayasan->get_paged($config['per_page'],$offset,$filter);

		//json
		$this->_built_json(json_encode($data));	
	}
}
//end of file directory